Talk:Working with CSV files
Name of tip I'm wondering about the title "Navigate large CSV files more easily". It's not just large CSV files where this is handy, and I generally try to avoid weasel words like "more easily". What do you think about renaming it to "Working with CSV files"? Any other ideas? --JohnBeckett 02:00, 13 July 2008 (UTC) :I would support changing the name to "Working with CSV Files". I think it captures the features of this tip better. Also it leaves room for future improvements. -- lpr612 ::I have renamed it. --JohnBeckett 12:02, 19 July 2008 (UTC) Featured tip Congratulations folks! The tip is magnificent, although if the script gets much longer it will need to be made a plugin on vim.org (I'm resisting the tempatation to make it handle tab delimiters, which wouldn't be too hard now we have GetExpr()). I'm going to feature this on the Main Page, probably in August. --JohnBeckett 02:00, 13 July 2008 (UTC) ---- Yep, this tip has progressed very well, and it now has a quality that would warrant uploading to vim.org. The big disadvantage of vim.org is that only a single owner is able to upload new versions, and if that owner goes away, nobody can contribute any more. Here on the Wiki, everyone can collaborate on a script, and there doesn't need to be a single owner. How should this be handled? Maybe there could be one vim.org login VimTipsUser, with password and rules and guidelines posted somewhere here in the Wiki, that can then be used by anyone from the Wiki community to upload new versions to vim.org?! (Assuming the vim.org owners are okay with posting such an open login to their site, and the potential for spam and vandalism.) What do you think? Have other tips from here already made the move to a vim.org script (without a single owner/adopter)? -- Inkarkat 11:04, 13 July 2008 (UTC) ---- That's an attractive idea. I vaguely recall (but have forgotten the details) that in recent months there was a tip that someone developed into a script on vim.org. In the past, that has happened several times. However, as you point out, the script then suffers bit rot because usually the author moves on to other things and no maintenance occurs. We have no system for collaborative access to vim.org. At the moment, I'm inclined to leave things the way they are until we get a case where someone really wants to proceed. We could have a public name/password, or we could have a page explaining that there is a well-known account, and if someone wants it they can email of 3 or 4 users here. For email, I would be inclined to NOT publish any email addresses (even if obfuscated). Instead, rely on the Wikia procedure whereby there is an "email this user" link (that requires the sender to have a Wikia account, and the recipient to have supplied an email address; the sender does not see that address unless the recipient replies). Also, I'm somewhat selfishly wanting to keep this tip here, at least for the moment. In general, I wouldn't want to have that long script on a tip and a maintained plugin on vim.org. So, if you really want to make a plugin with yourself as the initial maintainer, let's sort out the details. Otherwise, let's wait until this tip has developed even further. Another option: It is possible to upload binary files to the wiki. So, we could upload a zip (or text file, or whatever), and provide a link for a download. This procedure uses the "Image" feature of the wiki (whereby it is possible to upload images). I'm not sure what Wikia thinks of this, but I could easily find out (I don't think they would mind), and I have noticed it elsewhere (we haven't done it). --JohnBeckett 00:28, 14 July 2008 (UTC) Talk pages on this wiki Just so everyone knows, we normally try to avoid using talk pages to comment on tips. Instead, if you see something that should be noted in a tip (an improvement, a defect, a question about the tip), please just add to the Comments section at the bottom (use a line consisting of only to give a horizontal rule to separate each comment). We find that generally is easier for editors and readers (if there may be a problem in a tip, a reader should see the comment raising the problem, without needing to examine the talk page as well). Note also that here we don't keep comments (we just want tips without too many distractions). As soon as a comment is dealt with, it should be deleted (although if a newcomer has a comment, I would generally keep the comment for at least a week, with some sort of reply to indicate why the comment was not applicable). Likewise, unless this discussion keeps going, I'll probably recommend deletion of this talk page in a couple of months (if there's nothing of long-term value remaining on it). This is the first time that we have had a real reason for holding a discussion on the talk page of a tip, so go wild with any suggestions! --JohnBeckett 02:00, 13 July 2008 (UTC) Highlighting within status line Question: Is it possible to highlight the column header on the status line to be the same color as the highlighted column? It is some small convenience, I think it would be nice to have although what we have now is pretty good already. :No, that's not possible; only the entire status message can be highlighted, not parts of it. -- Inkarkat 09:32, 15 July 2008 (UTC) Sorting by column When I get some quality time, I might try and better understand lpb612's amazing regexs. I suspect that some minor tweaks would give a pattern that you could use so :sort would sort based on the fields in a column! --JohnBeckett 12:02, 19 July 2008 (UTC) Search within column (original) I have added a new feature: search within column. See the introduction before the script. Lpb612 03:19, 18 July 2008 (UTC) :More magnificent magic! --JohnBeckett 09:09, 19 July 2008 (UTC) ---- Hi lpb612: Please check following. These comments are obsolete -- see next section. I notice that :SC 2=john works very nicely, but it doesn't highlight the hits (I use :set hlsearch). The following line used instead of the current line seems to fix this issue. I used 'normal' (not 'normal!') so that the mapping for 'n' is used. command! -nargs=1 SC execute SearchCol("") | normal n --JohnBeckett 12:25, 19 July 2008 (UTC) ---- Hmmm. I wonder if the autocommands should test the current filetype. If it is csv, proceed as occurs now. But if it has been switched off (:set ft= as per new "Usage" info I have just added), maybe the autocommands should do nothing. Or can the "undo_ftplugin" delete the autocommands? --JohnBeckett 12:25, 19 July 2008 (UTC) ---- Search within column (new) I have implemented a new version of csv.vim: *Expands undo_ftplugin so more changes are undone, including removal of the autocommands. That means set ft= really does turn off highlighting. *Uses 'normal n' in the SC command so the first search highlights hits (if 'hlsearch' is set). *Uses matchadd() rather than :match so a priority can be assigned to the highlight. That allows search hits to be highlighted in the current column (and leaves the :match command available for the user). My code needs checking (there are a couple of things I'm not sure about)! Please fix any issues you find, or if it's ok let me know here. RESPONSE I checked the new version with matchadd. It works where matchadd is provided (new version of vim?). But it seems that not all VIM 7.1 has matchadd. Another solution, as you (JohnBeckett) mentioned is the following: use "2match Keyword" instead of "match Keyword" in the s:Highlight function, and add execute 'match Search /\c' . @/ . '/' at the end of SearchCol function. This way, the SC search has a higher priority than "Keyword" match. Thanks JohnBeckett for both pointing out the problem, and also providing (two!) solutions. --- lpb612 05:32, 20 July 2008 (UTC) I guess everyone knows that you can use the 'history' tab on the wiki to see old versions. If you click the date for a particular version, that version if opened. If wanted, you can edit the old version and copy out all the wikitext to a local file. That's a good way to compare two versions, although the wiki difference tool on the history page is surprisingly good and is often all that you need. Be careful not to save an old version unless you want to wipe out changes since that time. --JohnBeckett 04:21, 20 July 2008 (UTC) ----